﻿using System.Windows;
using System.Windows.Controls;

namespace Red.Launcher.Menus.Workspaces.Admin
{
    public partial class RecordChildrenView : UserControl
    {
        #region C-Tor

        public RecordChildrenView()
        {
            InitializeComponent();
        }

        #endregion C-Tor

        #region Public Properties

        public string Title
        {
            get { return (string)GetValue( TitleProperty ); }
            set { SetValue( TitleProperty, value ); }
        }

        public string ButtonTooltip
        {
            get { return (string)GetValue( ButtonTooltipProperty ); }
            set { SetValue( ButtonTooltipProperty, value ); }
        }

        public bool CanCreateChild
        {
            get { return (bool)GetValue( CanCreateChildProperty ); }
            set { SetValue( CanCreateChildProperty, value ); }
        }

        public object Buttons
        {
            get { return (object)GetValue( ButtonsContentProperty ); }
            set { SetValue( ButtonsContentProperty, value ); }
        }

        #endregion Public Properties

        #region Private Dependency Properties

        private static readonly DependencyProperty TitleProperty =
        DependencyProperty.Register
        (
            "Title",
            typeof( string ),
            typeof( RecordChildrenView )
        );

        private static readonly DependencyProperty ButtonTooltipProperty =
        DependencyProperty.Register
        (
            "ButtonTooltip",
            typeof( string ),
            typeof( RecordChildrenView )
        );

        private static readonly DependencyProperty CanCreateChildProperty =
        DependencyProperty.Register
        (
            "CanCreateChild",
            typeof( bool ),
            typeof( RecordChildrenView ),
            new PropertyMetadata( true )
        );

        private static readonly DependencyProperty ButtonsContentProperty =
        DependencyProperty.Register
        (
            "Buttons",
            typeof( object ),
            typeof( RecordChildrenView )
        );

        #endregion Private Dependency Properties

        #region Event Handlers

        private void CreateItem_Click( object sender, RoutedEventArgs e )
        {
            if ( CreateItemClick != null )
            {
                CreateItemClick( sender, e );
            }
        }

        #endregion Event Handlers

        #region Public Events

        public delegate void OnCreateItemClicked( object sender, RoutedEventArgs e );
        public event OnCreateItemClicked CreateItemClick;

        #endregion Public Events
    }
}
